home *** CD-ROM | disk | FTP | other *** search
- #include<dos.h>
-
- VidGetCurPos(int *row, int *col) /* INLINE version */
- {
- _AH = 3;
- _BH = 0;
- asm int 10h; /* call video interrupt */
- *row = _DH;
- *col = _DL;
- }
- Note that the assembler produced from this is:
-
- _VidGetCurPos proc near
- push bp
- mov bp,sp
- mov ah,3 ; _AH = 3
- mov bh,0 ; _BH = 0
- int 10h ; Int10h
- mov al,dh
- mov ah,0
- mov bx,word ptr [bp+4]
- mov word ptr [bx],ax ; row = _DH
- mov al,dl
- mov ah,0
- mov bx,word ptr [bp+6]
- mov word ptr [bx],ax ; col = _DL
- pop bp
- ret
- _VidGetCurPos endp
-
-
- VidGetCurPos(int *row, int *col) /* Int86() version */
- {
- union REGS r;
-
- r.h.ah = 3;
- r.h.bh = 0;
- int86(0x10,&r,&r);
- *row = r.h.dh;
- *col = r.h.dl;
- }
- However, the assembler produced from this function is much larger,
- and slower:
-
- _VidGetCurPos proc near
- push bp
- mov bp,sp
- sub sp,16 ; allocate the register structure
- mov byte ptr [bp-15],3 ; r.h.ah = 3
- mov byte ptr [bp-13],0 ; r.h.bh = 0
- lea ax,word ptr [bp-16]
- push ax
- lea ax,word ptr [bp-16]
- push ax
- mov ax,16
- push ax
- call near ptr _int86 ; int86() - additional overhead
- add sp,6
- mov al,byte ptr [bp-9]
- mov ah,0
- mov bx,word ptr [bp+4]
- mov word ptr [bx],ax ; row = r.h.dh
- mov al,byte ptr [bp-10]
- mov ah,0
- mov bx,word ptr [bp+6]
- mov word ptr [bx],ax ; col = r.h.dl
- mov sp,bp
- pop bp
- ret
- _VidGetCurPos endp
-